<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html lang="en">
<head>
<script type="text/javascript">
	function show() {
		document.getElementById('newdetail').style.display = "block";
		InsertJSSkill.skillID.selectedIndex = 0;
	}
	function hide() {
		document.getElementById('newdetail').style.display = "none";
	}

	function Edit_Profile_Validator() {

		var email = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

		if (updateCompanyProfile.companyName.value == "") {
			alert("Please enter company name.");
			updateCompanyProfile.companyName.focus();
			return (false);
		}

		if (updateCompanyProfile.emailID.value == "") {
			alert("Please enter email address.");
			updateCompanyProfile.emailID.focus();
			return (false);
		}

		if (email.test(updateCompanyProfile.emailID.value) == false) {
			alert('Please enter a valid email address.');
			return false;
		}

		if (updateCompanyProfile.phoneNumber.value == "") {
			alert("Please enter phone number.");
			updateCompanyProfile.phoneNumber.focus();
			return (false);
		}

		return (true);
	}

	function insertJobposting_Validator() {

		if (insertJobposting.jobCode.value == "") {
			alert("Please enter job code.");
			insertJobposting.jobCode.focus();
			return (false);
		}

		if (insertJobposting.jobDescription.value == "") {
			alert("Please enter job description.");
			insertJobposting.jobDescription.focus();
			return (false);
		}

		if (insertJobposting.qualification.value == "") {
			alert("Please enter qualification.");
			insertJobposting.qualification.focus();
			return (false);
		}

		if (insertJobposting.skillID.value == -1) {
			alert("Please select skill.");
			insertJobposting.skillID.focus();
			return (false);
		}

		if (insertJobposting.location.value == "") {
			alert("Please enter location.");
			insertJobposting.location.focus();
			return (false);
		}

		return (true);
	}

	$(function() {
		$('.chzn-select').chosen();
		$('.chzn-select-deselect').chosen({
			allow_single_deselect : true
		});
	});

	function activePane() {
		var tabID = '${tabID}';
		if (tabID == "jobPostings") {
			document.getElementById("jobPostings").className = "tab-pane active";
			document.getElementById("profile").className = "tab-pane";
			document.getElementById("profileLink").className = "";
			document.getElementById("jobPostingsLink").className = "active";
		}

		if (tabID == "profile") {
			document.getElementById("profile").className = "tab-pane active";
			document.getElementById("jobPostings").className = "tab-pane";
			document.getElementById("jobPostingsLink").className = "";
			document.getElementById("profileLink").className = "active";
		}
	}
</script>
<link href="UserInterface/css/bootstrap.css" rel="stylesheet"
	type="text/css" />
<script src="UserInterface/js/jquery.js"></script>
<script type="text/javascript" src="UserInterface/js/bootstrap-tab.js"></script>
<title></title>
</head>
<body onload="activePane();hide()">
	<br />
	<div class="container">
		<div class="row">
			<div class="span12">
				<!-- login form start-->
				<!--  <div class="well">-->
				<ul class="nav nav-tabs">
					<li class="active" id="profileLink"><a href="#profile"
						data-toggle="tab">Profile</a></li>
					<li id="jobPostingsLink"><a href="#jobPostings"
						data-toggle="tab" onclick="hide()">Job Postings</a></li>
				</ul>
				<div class="tab-content">
					<!-- =================================Profile Tab Begin=========================================== -->
					<div class="tab-pane active" id="profile">

						<br />
						<div align="center">
							<font size="5" face="Georgia"><b>Basic Details</b></font> <br />
							<br /> <br />
						</div>

						<s:form name="updateCompanyProfile" action="updateCompanyProfile"
							onsubmit="return Edit_Profile_Validator()">

							<table class="table table-bank-bordered table-bank-striped">
								<tr>

									<th style="text-align: center"><font size="4"
										face="Georgia">Name</font></th>
									<td style="text-align: center"><input type="text"
										name="companyName" class="input-large"
										value="<s:property value="company.companyName" />"></td>
								</tr>
								<tr>
									<th style="text-align: center"><font size="4"
										face="Georgia">Email Address</font></th>
									<td style="text-align: center"><input type="text"
										name="emailID" class="input-large"
										value="<s:property value="company.emailID" />"></td>
								</tr>
								<tr>
									<th style="text-align: center"><font size="4"
										face="Georgia">Phone Number</font></th>
									<td style="text-align: center"><input type="text"
										name="phoneNumber" class="input-large"
										value="<s:property value="company.phoneNumber" />"></td>
								</tr>
							</table>

							<button class="btn btn-medium btn-primary pull-right"
								type="submit">Save</button>
						</s:form>

					</div>
					<!-- =================================Profile Tab End=========================================== -->

					<!-- =================================Job Postings Tab Begin=========================================== -->
					<div class="tab-pane" id="jobPostings">

						<br />
						<div align="center">
							<font size="5" face="Georgia"><b>Job Postings</b></font> <br />
							<br /> <br />
						</div>

						<table
							class="table-bank table-bank-bordered table-bank-hover table-bank-striped"
							id="results">
							<tr>
								<th style="text-align: center"><font size="4"
									face="Georgia">Job Code</font></th>
								<th style="text-align: center"><font size="4"
									face="Georgia">Job Description</font></th>
								<th style="text-align: center"><font size="4"
									face="Georgia">Qualifications</font></th>
								<th style="text-align: center"><font size="4"
									face="Georgia">Skills</font></th>
								<th style="text-align: center"><font size="4"
									face="Georgia">Location</font></th>
								<th style="text-align: center"><font size="4"
									face="Georgia">Delete</font></th>
							</tr>
							<s:iterator value="jobpostingList">
								<tr>
									<td style="text-align: center"><s:property value="jobCode" /></td>
									<td style="text-align: center"><s:property value="jobDesc" /></td>
									<td style="text-align: center"><s:property
											value="qualification" /></td>
									<td style="text-align: center"><s:property
											value="skillName" /></td>
									<td style="text-align: center"><s:property
											value="location" /></td>
									<td style="text-align: center"><a
										href="DeleteJobPosting?jobID=<s:property
									value="jobID" />">
											<i class="icon-trash"></i>
									</a></td>
								</tr>
							</s:iterator>
						</table>

						<div id="pageNavPosition" align="center"></div>
						<br />

						<div align="center">
							<form action="InsertJobPosting" class="form-inline"
								id="newdetail" name="insertJobposting"
								onsubmit="return insertJobposting_Validator()">
								<input type="text" class="input-medium" placeholder="Job Code"
									name="jobCode"> <input type="text" class="input-medium"
									placeholder="Job Description" name="jobDescription"> <input
									type="text" class="input-medium" placeholder="Qualification"
									name="qualification">
								<s:select name="skillID" headerKey="-1"
									headerValue="Select Skill" list="skillMasterList"
									listKey="skillID" listValue="skillName" cssClass="chzn-select"
									style="width:200px" />
								<input type="text" class="input-medium" placeholder="Location"
									name="location">
								<button type="submit" class="btn btn-medium">Save</button>
							</form>
						</div>
						<button class="btn btn-small btn-primary pull-right" type="button"
							onclick="show()">Add Row</button>
					</div>
					<!-- =================================Job Postings Tab End=========================================== -->
					<div class="tab-pane" id="trainer">trainer</div>
				</div>
			</div>
		</div>
		<%
			session.setAttribute("tabID", "");
		%>
	</div>

	<script type="text/javascript">
		var pager = new Pager('results', 10);
		pager.init();
		pager.showPageNav('pager', 'pageNavPosition');
		pager.showPage(1);
	</script>
	<br />
	<br />
	<br />

</body>
</html>
